package com.frejoys.common.enums;

import cn.hutool.core.util.StrUtil;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

// 店铺活动类型
public enum EStoreActivityType {

    queueRebate(1,"排队返利"),
    shareRebate(2,"共享股东");

    private Integer key;
    private String value;

    EStoreActivityType(Integer key,String value) {
        this.key = key;
        this.value = value;
    }

    public Integer getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static String getValueByKey(Integer key) {
        Map<Integer, String> m = getMap();
        String v = m.get(key);
        return StrUtil.isNotEmpty(v) ? v : "";
    }

    public static Map<Integer, String> getMap() {
        return Stream.of(EStoreActivityType.values())
                .collect(Collectors.toMap(EStoreActivityType::getKey, EStoreActivityType::getValue));
    }

}
